import requests

if __name__ == "__main__":
    # 定义一个请求头(模拟浏览器)
    headers = {
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36'}

    # 定义代理的字典(可以去http://www.xicidaili.com查找最新的代理)
    proxies = {
        'http': 'http://115.223.223.29:9000',
        'https': 'https://197.232.21.141:59075'
    }
    response = requests.get('http://httpbin.org/get', headers=headers, proxies=proxies)
    response.encoding = 'utf-8'
    print(response.text)